package base.innerclass;

// 成员内部类
public class T3 {

    public static void main(String[] args) {
        new Outer03().f();
        Outer03 outer03 = new Outer03();
        // 第一种：外部类调用, 相当于把 new Inner03() 当做外部类的成员
        Outer03.Inner03 inner03 = outer03.new Inner03();
        // 第二种： 在外部类中写一个方法，来返回内部类
        Outer03.Inner03 inner031 = outer03.get();
    }
}

class Outer03{
    private int age=18;
    public String name="张三";
    private void n1(){
        System.out.println("Outer n1");
    }
    class Inner03{
        public void m1(){
            System.out.println("Inner m1");
            System.out.println(age+name);
            n1();
        }
    }
    public void f(){
        Inner03 inner03 = new Inner03();
        inner03.m1();
    }
    public Inner03 get(){
       return new Inner03();
    }
}
